const {ccclass, property} = cc._decorator;

declare class QRCode{
    constructor(div,url:string);
}

@ccclass
export default class NewClass extends cc.Component {


    onLoad () {
        var div = document.createElement("div");
        var qrcode = new QRCode(div, "http://www.cocos.com/");        
        var img = div.children[1];
        img.onload = () => {
            var texture = new cc.Texture2D();
            texture.initWithElement(img);
            texture.handleLoadedTexture();
            var spriteFrame = new cc.SpriteFrame(texture);
            var node = new cc.Node();
            var sprite = node.addComponent(cc.Sprite);
            sprite.spriteFrame = spriteFrame;
            this.node.addChild(node);
        }
    }

    start () {

    }

    // update (dt) {}
}

 
